<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
		<title>评论管理</title>
		<link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
		<link rel="stylesheet" href="/static/web/css/bootstrap.min.css">
		<link rel="stylesheet" href="/static/web/css/admin.css">
		<script src="/static/web/js/jquery.min.js"></script>
		<script src="/static/web/js/bootstrap.min.js"></script>
		<script src="/static/web/js/admin.main.js"></script>
	</head>
	<body>
		<form name="form1">
			<table class="table shadow-sm my-3">
				<tr>
					<td>
						<input type="text" name="keyword" placeholder="请输入关键词" class="admin-input-lg mr-3">
						<select name="typeid" class="admin-input-sm">
							<option value="0">请选择</option>
							{dede:global.openarray/}
						</select>
						<button type="submit" name="submit" class="btn btn-success btn-sm">搜索</button>
					</td>
				</tr>
			</table>
		</form>
		<form name="feedback">
			<table class="table shadow-sm mb-3">
				<tr>
					<td colspan="8">评论列表</td>
				</tr>
				<tr align="center">
					<td width="6%">选择</td>
					<td width="10%">名称</td>
					<td width="20%">文档</td>
					<td width="20%">评论</td>
					<td width="10%">地址</td>
					<td width="10%">时间</td>
					<td width="10%">状态</td>
					<td>操作</td>
				</tr>
				{dede:datalist empty='<tr><td colspan="8" align="center">暂无记录</td></tr>'}
				<tr align="center">
					<td><input type="checkbox" name="fid" id="fid" value="{dede:field.id/}"></td>
					<td align="left">{dede:field.username/}</td>
					<td align="left">{dede:field.arctitle function="RemoveXSS(@me)"/}</td>
					<td align="left">
						<span>{dede:field.msg function='cn_substr(Text2Html(@me),280)'/}</span>
						<?php if ($fields['replycount'] > 0) {?><a href='feedback_main.php?fid={dede:field.id/}' class='btn btn-light btn-sm'>{dede:field.replycount/}条回复</a><?php }?>
					</td>
					<td><a href='feedback_main.php?ip={dede:field.ip/}'>{dede:field.ip/}</a></td>
					<td>{dede:field.dtime function="GetDateTimeMK(@me)"/}</td>
					<td>{dede:field.ischeck function="IsCheck(@me)"/}</td>
					<td>
						<a href="feedback_edit.php?id={dede:field.id/}" class="btn btn-light btn-sm"><i class="fa fa-pencil-square"></i> 修改</a>
						<a href="feedback_edit.php?id={dede:field.id/}&dopost=makehtml" class="btn btn-light btn-sm"><i class="fa fa-repeat"></i> 更新</a>
						<a href="archives_do.php?aid={dede:field.aid/}&dopost=viewArchives" target="_blank" class="btn btn-light btn-sm"><i class="fa fa-eye"></i> 浏览</a>
					</td>
				</tr>
				{/dede:datalist}
				<tr>
					<td colspan="8">
						<button type="button" name="kk1" onclick="selAll();" class="btn btn-success btn-sm">全选</button>
						<button type="button" name="kk2" onclick="selNone();" class="btn btn-success btn-sm">取消</button>
						<button type="button" name="kk3" onclick="selNor();" class="btn btn-success btn-sm">反选</button>
						<button type="button" name="db2" onclick="checkFeedback();" class="btn btn-success btn-sm">审核评论</button>
						<button type="button" name="db" onclick="delFeedback();" class="btn btn-danger btn-sm">删除评论</button>
						<button type="button" name="db" onclick="delFeedbackIP();" class="btn btn-danger btn-sm">删除所有相同地址评论</button>
					</td>
				</tr>
				<tr>
					<td colspan="8" align="center">{dede:pagelist listsize='6'/}</td>
				</tr>
			</table>
		</form>
		<script>
			//获得选中文件的文件名
			function getCheckboxItem() {
				var allSel = '';
				if (typeof document.feedback.fid === "undefined") {
					return "";
				}
				if (document.feedback.fid.value) return document.feedback.fid.value;
				for (i = 0; i < document.feedback.fid.length; i++) {
					if (document.feedback.fid[i].checked) {
						if (allSel == "")
							allSel = document.feedback.fid[i].value;
						else
							allSel = allSel + "," + document.feedback.fid[i].value;
					}
				}
				return allSel;
			}
			function selAll() {
				if (typeof document.feedback.fid === "undefined") {
					return;
				}
				for (i = 0; i < document.feedback.fid.length; i++) {
					document.feedback.fid[i].checked = true;
				}
			}
			function selNone() {
				if (typeof document.feedback.fid === "undefined") {
					return;
				}
				for (i = 0; i < document.feedback.fid.length; i++) {
					document.feedback.fid[i].checked = false;
				}
			}
			function selNor() {
				if (typeof document.feedback.fid === "undefined") {
					return;
				}
				for (i = 0; i < document.feedback.fid.length; i++) {
					if (document.feedback.fid[i].checked == false)
						document.feedback.fid[i].checked = true;
					else
						document.feedback.fid[i].checked = false;
				}
			}
			function delFeedback() {
				var qstr = getCheckboxItem();
				if (qstr == "") {
					ShowMsg("您没选中任何文档");
					return
				};
				DedeConfirm("您确定要删除这些评论吗").then((v)=>{
					location.href = "feedback_main.php?job=del&fid=" + qstr
				}).catch((e)=>{
					console.log(e)
				});
			}
			function delFeedbackIP() {
				var qstr = getCheckboxItem();
				if (qstr == "") {
					ShowMsg("您没选中任何文档");
					return;
				};
				DedeConfirm("您确定要删除这些评论吗").then((v)=>{
					location.href = "feedback_main.php?job=delall&fid=" + qstr;
				}).catch((e)=>{
					console.log(e)
				});
			}
			function checkFeedback() {
				var qstr = getCheckboxItem();
				if (qstr == "") {
					ShowMsg("您没选中任何文档");
					return;
				};
				DedeConfirm("您确定要审核这些评论吗").then((v)=>{
					location.href = "feedback_main.php?job=check&fid=" + qstr;
				}).catch((e)=>{
					console.log(e)
				});
			}
			function editFeedback() {
				var qstr = getCheckboxItem();
				if (qstr == "") {
					ShowMsg("您没选中任何文档");
					return;
				}
				DedeConfirm("您确定要删除这些评论吗").then((v)=>{
					location.href = "feedback_edit.php?job=edit&fid=" + qstr;
				}).catch((e)=>{
					console.log(e)
				});
			}
		</script>
	</body>
</html>